var na = document.getElementById("na");
var state = 0;
na.addEventListener("blur",function(){
	var name1 = na.value;
	if(name1 == "")
	{
		document.querySelectorAll(".nameerror")[0].innerHTML = "编号不能为空";
		return ;
	}
	var xhr = new XMLHttpRequest();
	xhr.responseType = "json";
	xhr.open("get","/Manager/Category/getCategoryById.html?id="+name1,true);
	xhr.onload = function(){
		if(xhr.status == 200)
		{
			var res = xhr.response;
			if(parseInt(res.code) == 0)
			{
				state = 0;
				document.querySelectorAll(".nameerror")[0].innerHTML = res.message;
			}
			else
			{
				state = 1;
				document.querySelectorAll(".nameerror")[0].innerHTML = "";
			}
		}
	}
	xhr.send();
});
function myConfirm()
{
	var name1 = na.value;
	if(name1 == "")
	{
		document.querySelectorAll(".nameerror")[0].innerHTML = "编号不能为空";
		return false;
	}
	if(state == 0)
	{
		return false;
	}
	return confirm("确认下架编号为"+na.value+"的分类?");
}